<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="button" value="测试存储数据" onclick="testSave()">
    <input type="button" value="测试获取数据" onclick="testRead()">
    <input type="button" value="测试删除数据" onclick="testRemove()">
    <script>
        function testSave() {
            localStorage.setItem("testLocal", "hello,localStorage");
            sessionStorage.setItem("testSession", "hello,sessionStorage");
        }

        function testRead() {
            var testLocal = localStorage.getItem("testLocal");
            var testSession = sessionStorage.getItem("testSession");
            console.log("testLocal:"+testLocal);
            console.log("testSession:"+testSession);
        }
        function testRemove() {
            localStorage.removeItem("testLocal");
            sessionStorage.removeItem("testSession");
        }
    </script>
</body>
</html>